package com.lzw.bluetoothpractice.Activitys;

import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import android.os.Bundle;
import android.util.Log;

import com.lzw.bluetoothpractice.Adapters.MyAttentionListAdapter;
import com.lzw.bluetoothpractice.Models.Attention;
import com.lzw.bluetoothpractice.Models._User;
import com.lzw.bluetoothpractice.R;

import java.util.List;
import java.util.Queue;

import cn.bmob.v3.BmobQuery;
import cn.bmob.v3.BmobUser;
import cn.bmob.v3.exception.BmobException;
import cn.bmob.v3.http.bean.Init;
import cn.bmob.v3.listener.FindListener;
import cn.bmob.v3.listener.QueryListener;

public class MyAttentionActivity extends BaseActivity {

    RecyclerView rc_attention;
    private MyAttentionListAdapter myAttentionListAdapter;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_my_attention);
        InitView();
        InitData();
    }
    private void InitView(){
        InitNavBar(true,"我的关注",false);
        rc_attention=fd(R.id.rc_my_attention);

    }
    private void InitData(){
        BmobQuery<Attention> query =new BmobQuery<>();
        query.addWhereEqualTo("attedUserId",BmobUser.getCurrentUser(_User.class).getObjectId());
        query.findObjects(new FindListener<Attention>() {
            @Override
            public void done(List<Attention> list, BmobException e) {
               // Log.e("Attention",list.toString());
                rc_attention.setLayoutManager(new LinearLayoutManager(MyAttentionActivity.this));
                myAttentionListAdapter=new MyAttentionListAdapter(MyAttentionActivity.this,list);
                rc_attention.setAdapter(myAttentionListAdapter);
            }
        });

    }
}
